package demo1;

public class test3 {
    public static void main(String[] args) {
        System.out.println("lls");
        Thread t = new Thread(() -> {
            while(true){
                System.out.println("hello thread");
                try{
                    Thread.sleep(1000);
                }catch (InterruptedException e){
                    throw new RuntimeException(e);
                }
            }
        });

        //将t线程设为后台进程，只要main进程结束，整个进程就结束了
        t.setDaemon(true);
        t.start();
    }
}
